/**
 * @file ProtocolMessageCreator.cs
 * @author Zane Mayo
 * @date 12/5/2009
 */

using System;

namespace MxitAPI {
	
	
	public class ProtocolMessageCreator {
		
		private ProtocolMessageCreator() {	
		}
		
		public static ProtocolMessage CreateProtocolMessage( ProtocolMessageType protocolMessageType ) {
			
			ProtocolMessage protocolMessage;
			
			// Todo remove this once all message classes have been implimented
			protocolMessage = null;
			
			switch ( protocolMessageType ) {
			case ProtocolMessageType.Login:
				protocolMessage = new LoginProtocolMessage();
				break;
			case ProtocolMessageType.Logout:
				protocolMessage = new LogoutProtocolMessage();
				break;
			case ProtocolMessageType.GetContacts:
				protocolMessage = new GetContactsProtocolMessage();
				break;
			case ProtocolMessageType.UpdateContactInfo:
				protocolMessage = new UpdateContactInfoProtocolMessage();
				break;
			case ProtocolMessageType.SubscribeToContact:
				protocolMessage = new SubscribeToContactProtocolMessage();
				break;
			case ProtocolMessageType.RemoveContact:
				protocolMessage = new RemoveContactProtocolMessage();
				break;
			case ProtocolMessageType.GetNewMessages:
				protocolMessage = new GetNewMessagesProtocolMessage();
				break;
			case ProtocolMessageType.SendMessage:
				protocolMessage = new SendMessageProtocolMessage();
				break;
			case ProtocolMessageType.Register:
				//protocolMessage = new LoginProtocolMessage();
				break;
			case ProtocolMessageType.UpdateProfile:
				protocolMessage = new UpdateProfileProtocolMessage();
				break;
			case ProtocolMessageType.PollDifference:
				//protocolMessage = new LoginProtocolMessage();
				break;
			case ProtocolMessageType.GetProfile:
				protocolMessage = new GetProfileProtocolMessage();
				break;
			case ProtocolMessageType.GetMultimediaMessage:
				protocolMessage = new GetMultimediaMessageProtocolMessage();
				break;
			case ProtocolMessageType.RenameGroup:
				//protocolMessage = new LoginProtocolMessage();
				break;
			case ProtocolMessageType.RemoveGroup:
				//protocolMessage = new LoginProtocolMessage();
				break;
			case ProtocolMessageType.SplashScreenClickThrough:
				//protocolMessage = new LoginProtocolMessage();
				break;
			case ProtocolMessageType.SetPresence:
				protocolMessage = new SetPresenceProtocolMessage();
				break;
			case ProtocolMessageType.BlockSubscription:
				protocolMessage = new BlockSubscriptionProtocolMessage();
				break;
			case ProtocolMessageType.SendMessageToGroup:
				//protocolMessage = new SetMoodProtocolMessage();
				break;
			case ProtocolMessageType.SetMood:
				protocolMessage = new SetMoodProtocolMessage();
				break;
			case ProtocolMessageType.LoginKick:
				//protocolMessage = new LoginProtocolMessage();
				break;
			case ProtocolMessageType.CreateGroupChat:
				protocolMessage = new CreateGroupChatProtocolMessage();
				break;
			case ProtocolMessageType.AddGroupChatMember:
				protocolMessage = new AddGroupChatMembersProtocolMessage();
				break;
			case ProtocolMessageType.GetNewSubscription:
				protocolMessage = new GetNewSubscriptionProtocolMessage();
				break;
			case ProtocolMessageType.AllowSubscription:
				protocolMessage = new AllowSubscriptionProtocolMessage();
				break;
			case ProtocolMessageType.RegisterGateway:
				protocolMessage = new RegisterGatewayProtocolMessage();
				break;
			case ProtocolMessageType.DenySubscription:
				protocolMessage = new DenySubscriptionProtocolMessage();
				break;
			case ProtocolMessageType.UnregisterGateway:
				protocolMessage = new UnregisterGatewayProtocolMessage();
				break;
			case ProtocolMessageType.KeepAlive:
				protocolMessage = new KeepAliveProtocolMessage();
				break;
			default:
				protocolMessage = null;
				break;
			}
			
			return protocolMessage;
		}
		
		public static ProtocolMessage CreateProtocolMessage( int commandNum ) {
			return CreateProtocolMessage( ( ProtocolMessageType ) commandNum );
		}
		
		
	}
}
